package com.luyuan.crm.formula.model;

import com.luyuan.crm.product.model.Product;
import com.ruijie.foundation.bo.EntityObject;

public class Inventory extends EntityObject<String> implements Comparable<Inventory> {

    /**
     * 
     */
    private static final long serialVersionUID = 1L;

    /**
     * 产品
     */
    private Product product;

    private String name;

    private String specification;

    /**
     * 数量
     */
    private int quantity;

    /**
     * 总价
     */
    private double subtotal;

    private Formula formula;

    /**
     * 是否礼物 
     */
    private boolean gift = false;

    public Product getProduct() {
        return product;
    }

    public void setProduct(Product product) {
        this.product = product;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSpecification() {
        return specification;
    }

    public void setSpecification(String specification) {
        this.specification = specification;
    }

    public int getQuantity() {
        return quantity;
    }

    public void setQuantity(int quantity) {
        this.quantity = quantity;
    }

    public double getSubtotal() {
        return subtotal;
    }

    public void setSubtotal(double subtotal) {
        this.subtotal = subtotal;
    }

    public Formula getFormula() {
        return formula;
    }

    public void setFormula(Formula formula) {
        this.formula = formula;
    }

    public boolean isGift() {
        return gift;
    }

    public void setGift(boolean gift) {
        this.gift = gift;
    }

    @Override
    public int compareTo(Inventory o) {
        if (gift != o.gift) {
            return gift ? 1 : -1;
        }
        return (int) (subtotal - o.subtotal);
    }
}
